<template>
  <transition name="fade">
    <div v-if="visible" class="popup-overlay">
      <div class="popup-content">
        <button @click="closePopup">关闭</button>
        <slot>这是一个弹窗！111</slot>
      </div>
    </div>
  </transition>
</template>

<script setup>
import { ref, onMounted, onUnmounted } from 'vue';

defineProps({
  visible: {
    type: Boolean,
    default: false
  }
});

const emit = defineEmits(['close-popup']);

const closePopup = () => {
  emit('close-popup');
};

// 可以在这里添加更多组件级别的逻辑
</script>

<style scoped>
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.popup-content {
  width: 100%;
  max-width: 1500px;
  height: 600px;
  background-color: white;
  padding: 20px;
  border-radius: 5px;
  z-index: 101;
}

.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style>